Package-level declarations

Types

Link copied to clipboard
sealed class AnchorPoint
Link copied to clipboard
interface AxisModel<T>

An interface for classes representing a plot axis.

Link copied to clipboard
interface AxisState

Holds the offsets for major and minor ticks within an axis.

Link copied to clipboard
data class AxisStyle(val color: Color = Color.Black, val majorTickSize: Dp = 0.dp, val minorTickSize: Dp = 0.dp, val tickPosition: TickPosition = TickPosition.None, val lineWidth: Dp = 1.dp, val labelRotation: Int = 0)

Styling configuration for an Axis.

Link copied to clipboard
class CategoryAxisModel<T>(categories: List<T>, firstCategoryIsZero: Boolean = false, val minimumMajorTickSpacing: Dp = 50.dp) : AxisModel<T>

An axis that uses arbitrary category objects instead of numbers as its values. It is a discrete axis.

Link copied to clipboard
data class DefaultPoint<X, Y>(val x: X, val y: Y) : Point<X, Y>

Default implementation of the Point interface.

Link copied to clipboard
class DoubleLinearAxisModel(val range: ClosedFloatingPointRange<Double>, zoomRangeLimit: Double = (range.endInclusive - range.start) * ZoomRangeLimitDefault, minimumMajorTickIncrement: Double = (range.endInclusive - range.start) * MinimumMajorTickIncrementDefault, val minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true) : ILinearAxisModel<Double>

An AxisModel that uses Double values and is linear.

Link copied to clipboard
class FloatLinearAxisModel(val range: ClosedFloatingPointRange<Float>, zoomRangeLimit: Float = (range.endInclusive - range.start) * ZoomRangeLimitDefault.toFloat(), minimumMajorTickIncrement: Float = (range.endInclusive - range.start) * MinimumMajorTickIncrementDefault, val minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true) : AxisModel<Float> , ILinearAxisModel<Float>

An AxisModel that uses Float values and is linear.

Link copied to clipboard
Link copied to clipboard
class IntLinearAxisModel(val range: IntRange, zoomRangeLimit: Int = ((range.last - range.first) * ZoomRangeLimitDefault).coerceAtLeast(1.0).toInt(), minimumMajorTickIncrement: Int = ( (range.last - range.first) * MinimumMajorTickIncrementDefault ).toInt(), val minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true) : ILinearAxisModel<Int>

An AxisModel that uses Int values and is linear.

Link copied to clipboard
class LinearAxisModel(val range: ClosedFloatingPointRange<Float>, zoomRangeLimit: Float = (range.endInclusive - range.start) * ZoomRangeLimitDefault.toFloat(), minimumMajorTickIncrement: Float = (range.endInclusive - range.start) * MinimumMajorTickIncrementDefault, val minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true) : AxisModel<Float>

An AxisModel that uses Float values and is linear.

Link copied to clipboard
class LogAxisModel(range: ClosedRange<Int>, val minimumMajorTickSpacing: Dp = 50.dp) : AxisModel<Float>

A logarithmic axis.

Link copied to clipboard
class LongLinearAxisModel(val range: LongRange, zoomRangeLimit: Long = ((range.last - range.first) * ZoomRangeLimitDefault).coerceAtLeast(1.0).toLong(), minimumMajorTickIncrement: Long = ( (range.last - range.first) * MinimumMajorTickIncrementDefault ).toLong(), val minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true) : ILinearAxisModel<Long>

An AxisModel that uses Long values and is linear.

Link copied to clipboard
interface Point<X, Y>

Represents a point on a 2-d plot.

Link copied to clipboard

Specifies the position of axis ticks.

Link copied to clipboard
interface TickValues<T>

The major and minor tick values for an axis.

Link copied to clipboard

A scope for XY plots providing axis and state context.

Functions

Link copied to clipboard

Calculates an ClosedFloatingPointRange that can be used with a DoubleLinearAxisModel based on the min/max values of the provided list of Doubles. If the list is empty, returns a range of 0..1.

@JvmName(name = "autoScaleFloatRange")
fun List<Float>.autoScaleRange(): ClosedFloatingPointRange<Float>

Calculates an ClosedFloatingPointRange that can be used with a FloatLinearAxisModel based on the min/max values of the provided list of Floats. If the list is empty, returns a range of 0..1.

Calculates an IntRange that can be used with a IntLinearAxisModel based on the min/max values of the provided list of Ints. If the list is empty, returns a range of 0..1.

Calculates a LongRange that can be used with a LongLinearAxisModel based on the min/max values of the provided list of Longs. If the list is empty, returns a range of 0..1.

Link copied to clipboard

Calculates a ClosedFloatingPointRange that can be used with a LinearAxisModel based on the min/max X values of the provided list of Points.

Link copied to clipboard

Calculates a ClosedFloatingPointRange that can be used with a LinearAxisModel based on the min/max Y values of the provided list of Points.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.HorizontalLineAnnotation(location: Y, lineStyle: LineStyle)

Places a vertical line marker on the plot at the specified x-axis location styled using the provided lineStyle.

Link copied to clipboard
fun <X, Y> Point(x: X, y: Y): Point<X, Y>

Creates a new DefaultPoint at the specified coordinates.

Link copied to clipboard
fun rememberAxisStyle(color: Color = KoalaPlotTheme.axis.color, majorTickSize: Dp = KoalaPlotTheme.axis.majorTickSize, minorTickSize: Dp = KoalaPlotTheme.axis.minorTickSize, tickPosition: TickPosition = KoalaPlotTheme.axis.xyGraphTickPosition, lineWidth: Dp = KoalaPlotTheme.axis.lineThickness, labelRotation: Int = 0): AxisStyle

Creates and remembers an AxisStyle.

Link copied to clipboard
fun rememberDoubleLinearAxisModel(range: ClosedFloatingPointRange<Double>, zoomRangeLimit: Double = (range.endInclusive - range.start) * ZoomRangeLimitDefault, minimumMajorTickIncrement: Double = (range.endInclusive - range.start) * MinimumMajorTickIncrementDefault, minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true): DoubleLinearAxisModel

Create and remember a DoubleLinearAxisModel. See DoubleLinearAxisModel for parameter descriptions.

Link copied to clipboard
fun rememberFloatLinearAxisModel(range: ClosedFloatingPointRange<Float>, zoomRangeLimit: Float = (range.endInclusive - range.start) * ZoomRangeLimitDefault.toFloat(), minimumMajorTickIncrement: Float = (range.endInclusive - range.start) * MinimumMajorTickIncrementDefault, minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true): FloatLinearAxisModel

Create and remember a FloatLinearAxisModel. See FloatLinearAxisModel for parameter descriptions.

Link copied to clipboard
fun rememberIntLinearAxisModel(range: IntRange, zoomRangeLimit: Int = ((range.last - range.first) * ZoomRangeLimitDefault).toInt(), minimumMajorTickIncrement: Int = ((range.last - range.first) * MinimumMajorTickIncrementDefault).toInt(), minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true): IntLinearAxisModel

Create and remember an IntLinearAxisModel. See IntLinearAxisModel for parameter descriptions.

Link copied to clipboard
fun rememberLinearAxisModel(range: ClosedFloatingPointRange<Float>, zoomRangeLimit: Float = (range.endInclusive - range.start) * ZoomRangeLimitDefault.toFloat(), minimumMajorTickIncrement: Float = (range.endInclusive - range.start) * MinimumMajorTickIncrementDefault, minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true): FloatLinearAxisModel

Create and remember a LinearAxisModel.

Link copied to clipboard
fun rememberLongLinearAxisModel(range: LongRange, zoomRangeLimit: Long = ((range.last - range.first) * ZoomRangeLimitDefault).toLong(), minimumMajorTickIncrement: Long = ((range.last - range.first) * MinimumMajorTickIncrementDefault).toLong(), minimumMajorTickSpacing: Dp = 50.dp, minorTickCount: Int = 4, allowZooming: Boolean = true, allowPanning: Boolean = true): LongLinearAxisModel

Create and remember a LongLinearAxisModel. See LongLinearAxisModel for parameter descriptions.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.VerticalLineAnnotation(location: X, lineStyle: LineStyle)

Places a vertical line marker on the plot at the specified x-axis location styled using the provided lineStyle.

Link copied to clipboard
fun <X, Y> XYGraphScope<X, Y>.XYAnnotation(location: Point<X, Y>, anchorPoint: AnchorPoint, modifier: Modifier = Modifier, content: @Composable () -> Unit)

Places a Composable as an annotation on an XYGraph with the Composable's anchorPoint placed at the provided location.

Link copied to clipboard
fun <X, Y> XYGraph(xAxisModel: AxisModel<X>, yAxisModel: AxisModel<Y>, modifier: Modifier = Modifier, xAxisStyle: AxisStyle = rememberAxisStyle(), xAxisLabels: (X) -> String = { it.toString() }, xAxisTitle: String? = null, yAxisStyle: AxisStyle = rememberAxisStyle(), yAxisLabels: (Y) -> String = { it.toString() }, yAxisTitle: String? = null, horizontalMajorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.majorGridlineStyle, horizontalMinorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.minorGridlineStyle, verticalMajorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.majorGridlineStyle, verticalMinorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.minorGridlineStyle, panZoomEnabled: Boolean = true, content: @Composable XYGraphScope<X, Y>.() -> Unit)

An XYGraph overload that takes Strings for axis labels and titles instead of Composables for use cases where custom styling is not required.

fun <X, Y> XYGraph(xAxisModel: AxisModel<X>, yAxisModel: AxisModel<Y>, modifier: Modifier = Modifier, xAxisStyle: AxisStyle = rememberAxisStyle(), xAxisLabels: @Composable (X) -> Unit, xAxisTitle: @Composable () -> Unit = {}, yAxisStyle: AxisStyle = rememberAxisStyle(), yAxisLabels: @Composable (Y) -> Unit, yAxisTitle: @Composable () -> Unit = {}, horizontalMajorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.majorGridlineStyle, horizontalMinorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.minorGridlineStyle, verticalMajorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.majorGridlineStyle, verticalMinorGridLineStyle: LineStyle? = KoalaPlotTheme.axis.minorGridlineStyle, panZoomEnabled: Boolean = true, content: @Composable XYGraphScope<X, Y>.() -> Unit)

Provides a set of X-Y axes and grid for displaying X-Y plots.